
package calendario_teste;

import java.awt.Canvas;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;


public class MonthCanvas extends Canvas implements MouseListener {
	private int k_topRect = 20;
	private int k_width = 140;//*7
	private int k_height = 80;//*5
	private int h_string = 15;
	private int w_string = 120;
	private Color colorBackground = Color.white;
	private Color colorTopRect = new Color(179, 204, 220);
	private Dimension d ;

	private int day;
	
	private boolean mouseClk;

	public MonthCanvas(int day){
		this.day=day;
		mouseClk=false;
		d = new Dimension(k_width, k_height);
		setBackground(colorBackground);
		setSize(d); 
		
		addMouseListener(this);
		
	}
	
	public void paint(Graphics g){
		Graphics2D g2D=(Graphics2D) g;

		g2D.setColor(colorTopRect);
		g2D.fillRect(0,0,k_width,k_topRect);
		g2D.setColor(Color.black);
		g2D.drawString(Integer.toString(day), w_string, h_string);//
		g2D.drawRect(0, 0, k_width, k_height);
		if(mouseClk){
			g2D.drawString ("Oi Bentes", 10, k_height/2);
		}
	}

	public int getDay(){
		return day;
	}
	public void setDay(int day){
		this.day=day;
	}
	
	public void writeStringCenter(){
		
	}
	
	@Override
	public void mouseClicked(MouseEvent arg0) {
		// TODO Auto-generated method stub
		
		
	}

	@Override
	public void mouseEntered(MouseEvent arg0) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void mouseExited(MouseEvent arg0) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void mousePressed(MouseEvent arg0) {
		// TODO Auto-generated method stub
		mouseClk=true;
		repaint();
	}

	@Override
	public void mouseReleased(MouseEvent arg0) {
		// TODO Auto-generated method stub
		mouseClk=false;
		repaint();
	}
	


	
}
